home *** CD-ROM | disk | FTP | other *** search
/ Chip: 2001 Haziran / CHIP Haziran2001.iso / prog / haziran / 19 / setup.exe / data.z / int_gui.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-04-11  |  10.2 KB  |  312 lines

  1. VERSION 5.00
  2. Begin VB.Form int_gui 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Interrupt listener"
  5.    ClientHeight    =   3348
  6.    ClientLeft      =   48
  7.    ClientTop       =   336
  8.    ClientWidth     =   4968
  9.    Icon            =   "int_gui.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   3348
  14.    ScaleWidth      =   4968
  15.    StartUpPosition =   3  'Windows Default
  16.    Begin VB.Frame Frame1 
  17.       Caption         =   "IRQ Selection"
  18.       Height          =   2052
  19.       Left            =   240
  20.       TabIndex        =   6
  21.       Top             =   120
  22.       Width           =   4452
  23.       Begin VB.ComboBox ReqIrqList 
  24.          Height          =   288
  25.          ItemData        =   "int_gui.frx":0442
  26.          Left            =   1200
  27.          List            =   "int_gui.frx":0476
  28.          Style           =   2  'Dropdown List
  29.          TabIndex        =   1
  30.          Top             =   240
  31.          Width           =   2172
  32.       End
  33.       Begin VB.CheckBox Check11 
  34.          Alignment       =   1  'Right Justify
  35.          Appearance      =   0  'Flat
  36.          BackColor       =   &H8000000A&
  37.          Enabled         =   0   'False
  38.          ForeColor       =   &H80000008&
  39.          Height          =   192
  40.          Left            =   3720
  41.          TabIndex        =   19
  42.          Top             =   1440
  43.          Value           =   1  'Checked
  44.          Width           =   252
  45.       End
  46.       Begin VB.CheckBox Check9 
  47.          Alignment       =   1  'Right Justify
  48.          Appearance      =   0  'Flat
  49.          BackColor       =   &H8000000A&
  50.          Enabled         =   0   'False
  51.          ForeColor       =   &H80000008&
  52.          Height          =   192
  53.          Left            =   3000
  54.          TabIndex        =   18
  55.          TabStop         =   0   'False
  56.          Top             =   1680
  57.          Value           =   1  'Checked
  58.          Width           =   252
  59.       End
  60.       Begin VB.CheckBox Check8 
  61.          Alignment       =   1  'Right Justify
  62.          Appearance      =   0  'Flat
  63.          BackColor       =   &H8000000A&
  64.          Enabled         =   0   'False
  65.          ForeColor       =   &H80000008&
  66.          Height          =   192
  67.          Left            =   3000
  68.          TabIndex        =   17
  69.          TabStop         =   0   'False
  70.          Top             =   1440
  71.          Value           =   1  'Checked
  72.          Width           =   252
  73.       End
  74.       Begin VB.CheckBox Check7 
  75.          Alignment       =   1  'Right Justify
  76.          Appearance      =   0  'Flat
  77.          BackColor       =   &H8000000A&
  78.          Enabled         =   0   'False
  79.          ForeColor       =   &H80000008&
  80.          Height          =   192
  81.          Left            =   3000
  82.          TabIndex        =   16
  83.          TabStop         =   0   'False
  84.          Top             =   1200
  85.          UseMaskColor    =   -1  'True
  86.          Value           =   1  'Checked
  87.          Width           =   252
  88.       End
  89.       Begin VB.CheckBox Check6 
  90.          Appearance      =   0  'Flat
  91.          BackColor       =   &H8000000A&
  92.          Enabled         =   0   'False
  93.          ForeColor       =   &H80000008&
  94.          Height          =   192
  95.          Left            =   2280
  96.          TabIndex        =   15
  97.          Top             =   1680
  98.          Value           =   1  'Checked
  99.          Width           =   252
  100.       End
  101.       Begin VB.CheckBox Check3 
  102.          Appearance      =   0  'Flat
  103.          BackColor       =   &H8000000A&
  104.          Enabled         =   0   'False
  105.          ForeColor       =   &H80000008&
  106.          Height          =   192
  107.          Left            =   1800
  108.          TabIndex        =   14
  109.          Top             =   1680
  110.          Value           =   1  'Checked
  111.          Width           =   252
  112.       End
  113.       Begin VB.CheckBox Check2 
  114.          Appearance      =   0  'Flat
  115.          BackColor       =   &H8000000A&
  116.          Enabled         =   0   'False
  117.          ForeColor       =   &H80000008&
  118.          Height          =   192
  119.          Left            =   1800
  120.          TabIndex        =   13
  121.          Top             =   1440
  122.          Value           =   1  'Checked
  123.          Width           =   252
  124.       End
  125.       Begin VB.Label Label8 
  126.          Alignment       =   2  'Center
  127.          Caption         =   "Win95   Win98   WinNT4.0   Win2000"
  128.          Height          =   252
  129.          Left            =   1392
  130.          TabIndex        =   12
  131.          Top             =   960
  132.          Width           =   2940
  133.       End
  134.       Begin VB.Label Label7 
  135.          Caption         =   "12: Mouse"
  136.          Height          =   252
  137.          Left            =   240
  138.          TabIndex        =   11
  139.          Top             =   1680
  140.          Width           =   852
  141.       End
  142.       Begin VB.Label Label6 
  143.          Caption         =   "6:   Floppy Disk (A:)"
  144.          Height          =   252
  145.          Left            =   240
  146.          TabIndex        =   10
  147.          Top             =   1440
  148.          Width           =   1572
  149.       End
  150.       Begin VB.Label Label5 
  151.          Caption         =   "1:   Keyboard."
  152.          Height          =   252
  153.          Left            =   240
  154.          TabIndex        =   9
  155.          Top             =   1200
  156.          Width           =   1092
  157.       End
  158.       Begin VB.Label Label4 
  159.          Caption         =   "Common IRQs:"
  160.          Height          =   252
  161.          Left            =   120
  162.          TabIndex        =   8
  163.          Top             =   720
  164.          Width           =   1212
  165.       End
  166.       Begin VB.Line Line1 
  167.          BorderWidth     =   2
  168.          DrawMode        =   14  'Copy Pen
  169.          X1              =   120
  170.          X2              =   4200
  171.          Y1              =   660
  172.          Y2              =   660
  173.       End
  174.       Begin VB.Label Label3 
  175.          Caption         =   "Select IRQ:"
  176.          Height          =   252
  177.          Left            =   120
  178.          TabIndex        =   7
  179.          Top             =   300
  180.          Width           =   960
  181.       End
  182.    End
  183.    Begin VB.TextBox IntCount 
  184.       Alignment       =   2  'Center
  185.       Appearance      =   0  'Flat
  186.       BackColor       =   &H80000018&
  187.       Enabled         =   0   'False
  188.       Height          =   285
  189.       Left            =   3480
  190.       TabIndex        =   4
  191.       TabStop         =   0   'False
  192.       Text            =   "0"
  193.       Top             =   2400
  194.       Width           =   735
  195.    End
  196.    Begin VB.CommandButton DisEnInt_Button 
  197.       Caption         =   "Enable Interrupt"
  198.       Height          =   372
  199.       Left            =   480
  200.       TabIndex        =   0
  201.       Top             =   2280
  202.       Width           =   1572
  203.    End
  204.    Begin VB.CommandButton Exit_Button 
  205.       Caption         =   "Exit"
  206.       Height          =   372
  207.       Left            =   3240
  208.       TabIndex        =   3
  209.       Top             =   2880
  210.       Width           =   1215
  211.    End
  212.    Begin VB.CommandButton About_Button 
  213.       Caption         =   "About"
  214.       Height          =   372
  215.       Left            =   600
  216.       TabIndex        =   2
  217.       Top             =   2880
  218.       Width           =   1215
  219.    End
  220.    Begin VB.Label Label1 
  221.       Caption         =   "Interrupt count:"
  222.       Height          =   252
  223.       Left            =   2280
  224.       TabIndex        =   5
  225.       Top             =   2400
  226.       Width           =   1212
  227.    End
  228. Attribute VB_Name = "int_gui"
  229. Attribute VB_GlobalNameSpace = False
  230. Attribute VB_Creatable = False
  231. Attribute VB_PredeclaredId = True
  232. Attribute VB_Exposed = False
  233. ' File - int_gui.frm - code
  234. ' This application catches interrupts that are genereted by the
  235. ' computer components, and is controlled via a graphical user
  236. ' interface - int_gui.frm
  237. ' The interrupts are detected using WinDriver functions.
  238. Private hWD As Long
  239. Private lastIrq As Integer
  240. Private CurIrq As Integer
  241. Dim fStart As Boolean
  242. Private Sub About_Button_Click()
  243.     MsgBox "Interrupt listener Sample v1.0" & Chr$(13) & Chr$(13) & _
  244.     "This sample catches hardware interrupts" & Chr$(13) _
  245.     & " through the WinDriver's Visual Basic interface." _
  246.     & Chr$(13) & Chr$(13) & "Copyright (c) 2000 Jungo" _
  247.            , vbOKOnly, "About the Interrupt listener Sample"
  248. End Sub
  249. Private Sub Exit_Button_Click()
  250.     If (fStart) Then
  251.         Interrupt_Thread_Disable hWD
  252.     End If
  253.     Int_Close hWD
  254.     Unload int_gui
  255. End Sub
  256. Private Sub Form_Load()
  257.     int_gui.ReqIrqList.ListIndex = 1
  258.     lastIrq = 1
  259.     CurIrq = 1
  260.     If (Not Int_Open(hWD)) Then
  261.         Unload int_gui
  262.         GoTo finish
  263.     End If
  264.     fStart = False
  265. finish:
  266. End Sub
  267. Private Sub DisEnInt_Button_Click()
  268.     fStart = Not fStart
  269.     If (fStart) Then
  270.         If (Check_ReqIrq) Then
  271.             If (Not Interrupt_Thread_Enable(hWD, g_intrp, CurIrq)) Then
  272.                 fStart = Not fStart
  273.                 CurIrq = lastIrq
  274.                 int_gui.ReqIrqList.ListIndex = lastIrq
  275.             Else
  276.                 int_gui.DisEnInt_Button.Caption = "Disable IRQ " & int_gui.ReqIrqList.ListIndex
  277.             End If
  278.         Else
  279.             fStart = Not fStart
  280.         End If
  281.     Else
  282.         int_gui.DisEnInt_Button.Caption = "Enable Interrupt"
  283.         Interrupt_Thread_Disable hWD
  284.     End If
  285. End Sub
  286. Private Function Check_ReqIrq() As Boolean
  287.     Dim status
  288.     If (int_gui.ReqIrqList.ListIndex = CurIrq) Then
  289.         int_gui.IntCount = 0
  290.         Check_ReqIrq = True
  291.         GoTo finish
  292.     End If
  293.     status = MsgBox("Not all the IRQs are sharable. Listen to some" & Chr$(13) _
  294.     & "of them may be harmful to your application." & Chr$(13) _
  295.     & Chr$(13) & "                   Are you sure ?", vbYesNo + vbQuestion, "Did you know")
  296.     If (status <> vbYes) Then
  297.         int_gui.ReqIrqList.ListIndex = CurIrq
  298.         Check_ReqIrq = False
  299.         GoTo finish
  300.     End If
  301.     lastIrq = CurIrq
  302.     CurIrq = int_gui.ReqIrqList.ListIndex
  303.     int_gui.IntCount = 0
  304.     Check_ReqIrq = True
  305. finish:
  306. End Function
  307. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  308.     If (UnloadMode = vbFormControlMenu) Then
  309.     Exit_Button_Click
  310.     End If
  311. End Sub
  312.